package cn.tjd.sh.admin.controller;


import cn.tid.smart_health.api.CheckItemService;
import cn.tjd.smart_health.common.constant.MessageConstant;
import cn.tjd.smart_health.common.entity.CheckItem;
import cn.tjd.smart_health.common.util.R;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/checkitem")
public class CheckItemController {

    @DubboReference
    private CheckItemService checkItemService;

    @PostMapping("/add")
    public R add(@RequestBody CheckItem checkItem){
        try {
            checkItemService.saveCheckItem(checkItem);
            return new R(true, MessageConstant.ADD_CHECKGROUP_SUCCESS);
        }catch (Exception e){
            e.printStackTrace();
            return new R(false, MessageConstant.ADD_CHECKGROUP_FAIL);
        }
    }


}
